<template>
	<view class="content">
		<view class="row list" v-for="(item,index) in list" :key="index">
			<view class="col-22">
				<block v-if="item.name != ''">
					<view class="row">
						<view class="col-24 phone t_size_34">
							{{item.mobile}}
						</view>
						<view class="col-24 name t_size_28">
							{{item.name}}
						</view>
					</view>
				</block>
				<block v-else>
					<view class="row">
						<view class="col-24 phone_ t_size_34">
							{{item.mobile}}
						</view>
					</view>
				</block>
			</view>
			<view class="col-2 t_right">
				<image src="../../static/trip/yjt@2x.png" mode="heightFix"></image>
			</view>
		</view>
		<view class="btn">
			<button type="primary" @click="$public.navTo('public/urgent_add')">新增紧急联系人</button>
		</view>
	</view>
</template>

<script>
	export default {
		data(){
			return{
				objPage:{
					pageNum: 1,
					pageSize: 10
				},
				loading: true,
				list: []
			}
		},
		onShow() {
			this.objPage.pageNum = 1;
			this.list = [];
			this.loading = true;
			this.load();
		},
		onReachBottom() {
			this.objPage.pageNum += 1;
			this.load();
		},
		methods:{
			async load(){
				if(!this.loading){
					return
				}
				let res = await this.$api.request(this.$api.public.getlist,this.objPage);
				if(res){
					this.list = this.list.concat(res.list);
					if(res.list.length != this.objPage.pageSize){
						this.loading = false;
					}
				}
			}
		}
	}
</script>

<style lang="scss">
	page{
		background-color: #f5f5f5;
	}
	.content{
		padding-top: 21rpx;
	}
	.list{
		width: 92%;
		padding: 25rpx 4%;
		height: 90rpx;
		background-color: #FFFFFF;
		border-bottom: 1px solid #ededed;
		color: #333333;
		image{
			height: 30rpx;
			margin-top: 30rpx;
		}
		.phone{
			height: 55rpx;
			line-height: 55rpx;
		}
		.phone_{
			height: 90rpx;
			line-height: 90rpx;
		}
		.name{
			height: 35rpx;
			line-height: 35rpx;
			color: #999999;
		}
	}
	
	.btn{
		width: 92%;
		padding: 15rpx 4%;
		position: fixed;
		bottom: 0;
		left: 0;
		background-color: #FFFFFF;
		button{
			background-color: #6CBF30;
			height: 96rpx;
			line-height: 96rpx;
			border-radius: 48rpx;
		}
	}
</style>
